package com.example.command;

import com.example.command.Impi.LightONCommandImpi;
import com.example.command.Impi.LightOffCommandImpi;
import com.example.command.user.RemoteControl;

/**
 * 命令模式，操作和命令分开
 */
public class Test {
    public static void main(String[] args) {
        Light light = new Light();

        LightONCommandImpi lightONCommandImpi = new LightONCommandImpi(light);
        LightOffCommandImpi lightOffCommandImpi = new LightOffCommandImpi(light);


        RemoteControl remoteControl1 = new RemoteControl(lightONCommandImpi);
        RemoteControl remoteControl2 = new RemoteControl(lightOffCommandImpi);

        // 开灯
        remoteControl1.execute();

        remoteControl1.undo();

        // 关灯
        remoteControl2.execute();



    }
}
